package org.example.designPattern.behavioral.templateMethod;

import java.lang.reflect.Field;
import java.util.List;

public interface CommonExport<T> {
    default String export(List<T> list){
        System.out.println("当前文件上进度%5");

        for (T t : list) {
            try {
                Field fileUrl = t.getClass().getDeclaredField("fileUrl");
                String url = fileUrl.toString();
                String fileName = getFileName(t);
                System.out.println("将url" + url + "保存本地文件夹,文件名称" + fileName);
            } catch (NoSuchFieldException e) {
                throw new RuntimeException(e);
            }
        }

        System.out.println("将本地文件夹上传至阿里云");
        return "阿里云路径";
    }

    String getFileName(T t);
}
